import {
  Column,
  CreateDateColumn,
  Entity,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';
import { Exclude } from 'class-transformer';

@Entity('sys_user')
export class SysUser {
  @PrimaryGeneratedColumn({
    comment: '用户ID',
  })
  user_id: number;

  @Column({
    comment: '部门ID',
  })
  dept_id: number | null;

  @Column({ nullable: true, comment: '用户账号' })
  user_name: string;

  @Column({ name: 'nick_name', nullable: true, comment: '用户昵称' })
  nickName: string;

  @Column({
    comment: '用户类型（00系统用户）',
  })
  user_type: string | null;

  @Column({
    comment: '用户邮箱',
  })
  email: string | null;

  @Column({
    comment: '手机号码',
  })
  phonenumber: string | null;

  @Column({
    comment: '用户性别（0男 1女 2未知）',
  })
  sex: string | null;

  @Column({
    comment: '头像地址',
  })
  avatar: string | null;

  @Column({
    comment: '密码',
  })
  @Exclude()
  password: string | null;

  @Column({
    comment: '帐号状态（0正常 1停用）',
  })
  status: string | null;

  @Column({
    comment: '删除标志（0代表存在 2代表删除）',
  })
  del_flag: string;

  @Column({
    comment: '最后登录IP',
  })
  login_ip: string | null;

  @Column({
    comment: '最后登录时间',
  })
  login_date: Date | null;

  @Column({
    comment: '创建者',
  })
  create_by: string | null;

  @CreateDateColumn({
    comment: '创建时间',
  })
  create_time: Date;

  @Column({
    comment: '更新者',
  })
  update_by: string | null;

  @UpdateDateColumn({
    comment: '更新时间',
  })
  update_time: Date;

  @Column({
    comment: '备注',
  })
  remark: string | null;
}
